#ifndef MYSQLITE_H
#define MYSQLITE_H

#include <QMutex>
#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>

typedef struct {
    int operatorNumber;
    float data;
    QString time;
} operatorData;

class MySqlite : public QObject
{
    Q_OBJECT
public:    
    explicit MySqlite(QObject *parent = nullptr);
    void readConfig();
    bool connectSql();
    void set20000Data();
    void addData(operatorData p);
    void updataOperatorNumber();
    void clearDatas();
    int getOperatorNumber();
    ~MySqlite();
    QSqlQuery query;

    int operatorDataPoint=0;

private:
    QSqlDatabase mysqlite;

    QMutex queryLock;
    QList<operatorData> datas;
    int operatorNumber=0;
public slots:
    void insertDataToSql();
signals:

};

#endif // MYSQLITE_H
